<%@ page language="java" contentType="text/html; charset=utf-8" errorPage="/404.jsp" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>


<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <style type="text/css">
        @import url("<c:url value='/css/main.css'/>");
    </style>
    <title>修缮信息信息-房修缮信息列表</title>
</head>
<body>

<c:choose>
<c:when test="${empty pageInfo}">
    <%--	判断 request 中是否有分页，没有去请求	--%>
    <jsp:forward page="/repairlog/list.action"/>
</c:when>
<c:otherwise>
    <%--	有了分页，显示	--%>

<div class="div_main">
    <div class="div_header">修缮信息-列表</div>
    <div>
	    <span id="span_add">
		   <a href="<c:url value='/view/repairlog/add.jsp'/>" target="pageBox">添加修缮信息</a>
		</span>
    </div>
    <div class="div_data">
        <table class="tab_list">
            <tr>

                <th>编号</th>
                <th>工作人员编号</th>
                <th>房屋编号</th>
                <th>开始修复的时间</th>
                <th>结束修复的时间</th>
                <th>记录详情</th>
                <th>修复状态</th>


                <th>操作</th>
            </tr>
            <c:forEach items="${pageInfo.list}" var="repairlog">
                <tr>

                    <td>${repairlog.rid}</td>
                    <td>${repairlog.wid}</td>
                    <td>${repairlog.hid}</td>
                    <td>${repairlog.rstarttime}</td>
                    <td>${repairlog.rendtime}</td>
                    <td>${repairlog.rcontent}</td>
                    <td>${repairlog.rstatus}</td>


                    <td>
                        <a href="${pageContext.request.contextPath}/repairlog/getOne.action?id=${repairlog.rid}">详情</a>
                        &nbsp;&nbsp;
                        <a href="${pageContext.request.contextPath}/repairlog/getOne.action?id=${repairlog.rid}&method=update">编辑</a>

                        &nbsp;&nbsp;
                        <a href="#" onclick="confirmDelete(${repairlog.rid})">删除</a>
                    </td>
                </tr>
            </c:forEach>

        </table>
    </div>
    <div class="div_fenye">
        <span id="span_jilu">共有 ${pageInfo.total } 条记录，第 ${pageInfo.pageNum} / ${pageInfo.pages} 页 </span>
        <span id="span_fenye">
             <a href="${pageContext.request.contextPath}/repairlog/list.action?pageNo=${pageInfo.navigateFirstPage}">第一页</a>

				<c:if test="${pageInfo.hasPreviousPage}">
                    <a href="${pageContext.request.contextPath}/repairlog/list.action?pageNo=${pageInfo.pageNum-1}">上一页</a>
                </c:if>

			<c:if test="${pageInfo.hasNextPage}">
                <a href="${pageContext.request.contextPath}/repairlog/list.action?pageNo=${pageInfo.pageNum+1}">下一页</a>
            </c:if>

            <a href="${pageContext.request.contextPath}/repairlog/list.action?pageNo=${pageInfo.navigateLastPage}">最后一页</a>
				</span>
    </div>
</div>
<script>
    function confirmDelete(id) {
        if (confirm("确定要删除码？")) {
            window.location = "${pageContext.request.contextPath}/repairlog/deleteOne.action?id=" + id;
            // 重定向
        }
        return false;
    }


    </c:otherwise>
    </c:choose>


</script>
</body>
</html>